package com.syh.jn.scm.domain.supplier.entity.base.logistics;

import cn.redscarf.commons.util.bean.ExtBeanUtils;
import cn.redscarf.commons.util.other.ExtAssert;
import cn.redscarf.commons.util.validator.ValidationUtils;
import com.syh.core.ddd.domain.AbstractSimpleAggregate;
import com.syh.jn.scm.dto.supplier.base.logistics.logisticsAddress.LogisticsAddressMto;
import com.syh.jn.scm.dto.supplier.base.logistics.logisticsAddress.LogisticsAddressSto;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 物流服务地址
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class LogisticsAddress extends AbstractSimpleAggregate<Long> {
  public LogisticsAddress () {}

  /**
   * 添加物流地址
   * @param sto
   */
  public LogisticsAddress (LogisticsAddressSto sto) {
    ExtAssert.notNull(sto, "对象为空");
    ValidationUtils.validate(sto);

    this.createTimeStamp = System.currentTimeMillis();
    ExtBeanUtils.copyProperties(sto, this);
  }

  /**
   * 修改物流地址
   * @param mto
   */
  public void modify (LogisticsAddressMto mto) {
    ExtAssert.notNull(mto, "对象为空");
    ValidationUtils.validate(mto);
    ExtBeanUtils.copyProperties(mto, this);
    this.lastUpdateTimeStamp = System.currentTimeMillis();
  }
  /**
   * 数据销毁
   */
  public void destroy() {
  }
  /**
   * 物流公司id
   */
  private Long logisticsId;
  /**
   * 地址省 市 区
   */
  private String area;
  /**
   * 地址
   */
  private String address;
  /**
   * 地区编号
   */
  private String areaCode;
  /**
   * 联系人
   */
  private String contacts;
  /**
   * 联系手机
   */
  private String mobile;
}
